/**************************************************************************//**
 * @file     BSP_uart.h
 * @brief    UART Related Config Header File
 * @version  V1.00
 * @date     25. March 2017
 *
 * @note
 *
 ******************************************************************************/
#ifndef __BSP_UART_H__
#define __BSP_UART_H__

/********************************************************************************
 * Include section
 *******************************************************************************/
#include "stdint.h"
#include "SC32F58128.h"
#include "SC32F58128_Uart.h"

/********************************************************************************
 * Constants and macros
 *******************************************************************************/
#define DEBUG_UART   0

#if (DEBUG_UART==0)
  #define UART_BUFF         UART0->UARTDR_b.DATA
	#define UART_BUFF_ADD   &(UART0->UARTDR)
	#define TX_INT_EN         UART0->UARTIMSC_b.Transmit_IM = 1
	#define TX_INT_DIS        UART0->UARTIMSC_b.Transmit_IM = 0
	#define EN_UART_TXDMA()   EN_UART0_TXDMA()
	#define DIS_UART_TXDMA()  DIS_UART0_TXDMA()
	#define DBG_DMA_TRIG_SRC  0uL  //trig source uart0_Hs_tx;
#elif (DEBUG_UART==1)
  #define UART_BUFF         UART1->UARTDR_b.DATA
	#define UART_BUFF_ADD   &(UART1->UARTDR)
	#define TX_INT_EN         UART1->UARTIMSC_b.Transmit_IM = 1
	#define TX_INT_DIS        UART1->UARTIMSC_b.Transmit_IM = 0
	#define EN_UART_TXDMA()   EN_UART1_TXDMA()
	#define DIS_UART_TXDMA()  DIS_UART1_TXDMA()
	#define DBG_DMA_TRIG_SRC  2uL  //trig source uart1_ls_tx;
#elif (DEBUG_UART==2)
  #define UART_BUFF         UART2->UARTDR_b.DATA
	#define UART_BUFF_ADD   &(UART2->UARTDR)
	#define TX_INT_EN         UART2->UARTIMSC_b.Transmit_IM = 1
	#define TX_INT_DIS        UART2->UARTIMSC_b.Transmit_IM = 0
	#define EN_UART_TXDMA()   EN_UART2_TXDMA()
	#define DIS_UART_TXDMA()  DIS_UART2_TXDMA()
	#define DBG_DMA_TRIG_SRC  4uL  //trig source uart2_ls_tx;
#endif


/********************************************************************************
 * Typedefs, structs and enums
 *******************************************************************************/


/********************************************************************************
* Variables
*******************************************************************************/


/********************************************************************************
* prototypes of the functions
*******************************************************************************/
extern void Uart0Init(uint32_t brdRate);
extern void Uart1Init(uint32_t brdRate);
extern void Uart2Init(uint32_t brdRate);


/*---------------------------------- End of the file ---------------------------------*/
#endif /* __BSP_UART_H__ */

